//
//  TMGHelpTableViewCell.m
//  TMGold
//
//  Created by Mac on 2017/12/11.
//  Copyright © 2017年 tangmu. All rights reserved.
//

#import "TMGPlanTableViewCell.h"
@interface  TMGPlanTableViewCell()
@property(nonatomic, strong) STLabel                     *titleLable;

@property(nonatomic, strong) STLabel                     *winMoneyLable;

@end

@implementation TMGPlanTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 110;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];

    self.moneyButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 60)
                                                 title:@"0.00"
                                                titleColor:TM_orangeColor
                                                 titleFont:26
                                              cornerRadius:0
                                           backgroundColor:[UIColor whiteColor]
                                           backgroundImage:nil
                                                     image:nil];
    self.moneyButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.moneyButton st_showBottomLine];
//    self.moneyButton.userInteractionEnabled = NO;
    [self addSubview:self.moneyButton];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(15, 5, 200, 20)
                                                text:@"零钱计划(元)"
                                           textColor:TM_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];

    [self.moneyButton addSubview:self.titleLable];
    
    self.buyButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 55, 32)
                                                     title:@"赎回"
                                                titleColor:[UIColor whiteColor]
                                                 titleFont:13
                                              cornerRadius:3
                                           backgroundColor:TM_orangeColor
                                           backgroundImage:nil
                                                     image:nil];
    self.buyButton.right = UIScreenWidth - 15;
    self.buyButton.centerY = 30;
    self.buyButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.buyButton.userInteractionEnabled = YES;
    [self.moneyButton addSubview:self.buyButton];
    
    STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(15, self.moneyButton.bottom + 15, 200, 15)
                                                     text:@"累计收益(元)"
                                                textColor:TM_secendTextColor
                                                     font:14
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [self addSubview:titleLable];
    
    
    self.winMoneyLable = [[STLabel alloc] initWithFrame:CGRectMake(15, self.moneyButton.bottom + 15, 200, 15)
                                                   text:@"0.00"
                                                textColor:[UIColor blackColor]
                                                     font:14
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentRight];
    self.winMoneyLable.right = UIScreenWidth - 15;
    self.winMoneyLable.centerY = titleLable.centerY;
    [self addSubview:self.winMoneyLable];
    
//    self.moneyButton.userInteractionEnabled = NO;
}
- (void)setModel:(TMGPlanRecordModel *)model{
    _model = model;
    self.titleLable.text = model.name;
    self.buyButton.hidden = !model.canbuy;
    [self.moneyButton setTitle:model.assets forState:UIControlStateNormal];
    self.winMoneyLable.text = model.revenue;
}
@end



